package ch.ethz.fcl.metrobuzz.controller.gui.twl.frames;

import ch.ethz.fcl.metrobuzz.controller.gui.twl.treetable.CheckBoxCellRenderer;
import ch.ethz.fcl.metrobuzz.controller.gui.twl.treetable.MBBooleanModel;
import ch.ethz.fcl.metrobuzz.controller.gui.twl.treetable.MBTreeModel;
import ch.ethz.fcl.metrobuzz.controller.gui.twl.treetable.MBTreeTableNode;
import ch.ethz.fcl.metrobuzz.render.interchange.mrt.MRTInterchangeRender;
import de.matthiasmann.twl.ScrollPane;
import de.matthiasmann.twl.TreeTable;
import de.matthiasmann.twl.Widget;
import de.matthiasmann.twl.model.BooleanModel;

public class MRTLineControlTree {

	public Widget create() {
		MRTInterchangeRender.EWRender = true;
		MRTInterchangeRender.NSRender = true;
		MRTInterchangeRender.NERender = true;
		MRTInterchangeRender.CCRender = true;

		MBTreeModel m = new MBTreeModel();

		MBBooleanModel ew = new MBBooleanModel("EW",
				MRTInterchangeRender.EWRender);
		MBBooleanModel ns = new MBBooleanModel("NS",
				MRTInterchangeRender.NSRender);
		MBBooleanModel ne = new MBBooleanModel("NE",
				MRTInterchangeRender.NERender);
		MBBooleanModel cc = new MBBooleanModel("CC",
				MRTInterchangeRender.CCRender);

		MBTreeTableNode a = m.insert("MRT Lines", "");
		a.insert("East West (EW)", ew);
		a.insert("North South (NS)", ns);
		a.insert("North East (NE)", ne);
		a.insert("Circle Line (CC)", cc);

		TreeTable t = new TreeTable(m);
		t.setTheme("/table");
		t.setDefaultSelectionManager();
		t.registerCellRenderer(BooleanModel.class, new CheckBoxCellRenderer());

		ScrollPane scrollPane = new ScrollPane();
		scrollPane.setTheme("/tableScrollPane");
		scrollPane.setContent(t);
		return scrollPane;
	}
}
